/**
 * 
 */
package info.motteke.kurumi.swt;

import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.widgets.Shell;

final class ShellCloseListener extends ShellAdapter {
    private final Shell shell;

    ShellCloseListener(Shell shell) {
        this.shell = shell;
    }

    @Override
    public void shellClosed(ShellEvent e) {
        shell.setVisible(false);
        e.doit = false;
    }

    @Override
    public void shellIconified(ShellEvent e) {
        shell.setVisible(false);
    }

    @Override
    public void shellDeiconified(ShellEvent e) {
        shell.setVisible(true);
        shell.setActive();
    }
}